﻿using Amazon.Runtime.Internal.Util;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;
using NLog;
using System.Web.Mvc;

namespace B.S.Data.API
{
    /// <summary>
    /// 全局异常过滤器
    /// </summary>
    public class GuoFilters : IExceptionFilter
    {
        private readonly ILogger<GuoFilters> logger;

        public GuoFilters(ILogger<GuoFilters> logger)
        {
            this.logger = logger;
        }

        public void OnException(ExceptionContext context)
        {
            logger.LogError($"【捕获到异常信息内容为】" + context.Exception.Message);
        }
    }
}
